﻿using System;

namespace Cpu6502.Opcodes
{
    class JSR_A : Opcode
    {
        public JSR_A()
        {
            this.CpuCycles = 6;
            this.AddressType = CPU.AddressType.Absolute;
        }

        public override void Execute()
        {
            CPU.PC--;

            // Push Return address onto stack
            CPU.Stack.Push((byte)((CPU.PC >> 8) & 0xff));
            CPU.Stack.Push((byte)(CPU.PC & 0xff));

            // Set PC to new address
            CPU.PC = base.Argument;
        }
    }
}
